function cfdReadFlowMesh
%--------------------------------------------------------------------------
%  Written by LiuHaHa @ NWPU, 2021 01 
%  Contact me at: liuzhikan@mail.nwpu.edu.cn
%==========================================================================
% Routine Description:
%   This function reads file in mesh
%--------------------------------------------------------------------------
global cfdFlow slvpara;

fprintf('\nReading Mesh ...\n');

% Initialize mesh
cfdFlow.mesh = struct;
cfdFlow.coef = struct;

% Define file paths
meshFile = [slvpara.meshFile];

% if exist(meshFile,'dir')==0
%    error('\nError: The mesh  Folder doesnot exist \n');
% end
% cfdFlow.meshFile = pwd;
cfdFlow.meshFile = [cfdFlow.caseDirectoryPath, filesep ,meshFile];

pointsFile = [cfdFlow.meshFile,  filesep,'points'];
if exist(pointsFile,'file')==0
   error('\nError: The points file doesnot exist \n');
end
facesFile = [cfdFlow.meshFile, filesep,'faces'];
if exist(facesFile,'file')==0
   error('\nError: The faces file doesnot exist \n');
end
ownerFile = [cfdFlow.meshFile, filesep,'owner'];
if exist(ownerFile,'file')==0
   error('\nError: The owner file doesnot exist \n');
end
neighbourFile = [cfdFlow.meshFile, filesep,'neighbour'];
if exist(neighbourFile,'file')==0
   fprintf('\nError: The neighbour file doesnot exist \n');
   quit;
end
cfdBoundaryFile = [cfdFlow.meshFile, filesep,'boundary'];
if exist(cfdBoundaryFile,'file')==0
   error('\nError: The cfdBoundary file doesnot exist \n');
end

% Read Points
cfdReadFlowPointsFile(pointsFile);

% Read owners
cfdReadFlowOwnerFile(ownerFile);

% Read neighbours
cfdReadFlowNeighbourFile(neighbourFile);

% Read cfdBoundaries
cfdReadFlowBoundaryFile(cfdBoundaryFile);

% Read Faces
cfdReadFlowFacesFile(facesFile);

% Process topology
cfdFlowProcessTopology;

fprintf('\nEnd reading Mesh ...\n');
end








